package com.dingding.study.controller;

import com.dingding.study.annotation.DataItem;
import com.dingding.study.constant.ResourceType;
import com.dingding.study.service.CategoryService;
import com.dingding.study.service.自定义注解操作数据库.AnnotionHandleDB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author liugongding
 * @description:
 * @date 2022/9/19 9:22 PM
 */

@RestController
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private AnnotionHandleDB db;

    @DataItem(key = "自定义注解测试", value = "测试", type = ResourceType.STRING)
    public String test;

    @DataItem(key = "自定义注解测试1", value = "测试", type = ResourceType.MAP)
    public Map test1;

    @DataItem(key = "自定义注解测1试2", type = ResourceType.LIST)
    public List test2;


    @RequestMapping("/list/tree")
    public String list(String name) throws SQLException {
        return test;
    }

    @RequestMapping("/list/tree1")
    public Map list1(String name) throws SQLException {
        return test1;
    }

    @RequestMapping("/list/tree2")
    public List list2(String name) throws SQLException {
        return test2;
    }
}
